JLabel fatLabel with JTextField inFat JLabel calLabel with JTextField inCal JLabel perLabel with JTextField outPer
JPanel
sThe idea is to have five panels, one for each pair of label and text field, and a panel each for the heading and the do it button. The picture shows this grouping. (The lines around the panels do not appear in the actual GUI.)
Use add()
to place components in a panel.
FlowLayout
is the default layout manager for JPanel
.
Use setLayout()
only if you want a different layout manager.
Decide which components should be add
ed to each panel, then click the button
to see if you are correct.
At this point, the label and button components have been added to the five panels, but the panels have not yet been added to the frame.